home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 June: Reference Library / Dev.CD Jun 96 RL / Dev.CD Jun 96 RL.toast / Technical Documentation / develop / develop Issue 24 / develop Issue 24 code / Scriptable Database 1.0a15 / Foundation / GenericSearchSpec.cp < prev    next >
Encoding:
Text File  |  1996-02-19  |  3.6 KB  |  115 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        GenericSearchSpec.c
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Written by:    Andy Nicholas, Greg Anderson, Tom Conrad, Chris Bingham, Georgiann Puckett, John Thompson-Rohrlich
  7.  
  8.     Copyright:    © 1994-1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.          <9>     9/18/95    ga        
  11. */
  12.  
  13. #ifdef MWTRACEBACKTABLES
  14. #pragma traceback on
  15. #endif
  16.  
  17.  
  18. #include "GenericSearchSpec.h"
  19.  
  20. //
  21. // A generic search specification needs to be able to make
  22. // a generic search engine
  23. //
  24. //#include "GenericSearchEngine.h"
  25.  
  26. //
  27. // AbstractScriptableObject is needed to call the 'CompareProperty' method
  28. //
  29. #include "AbstractScriptableObject.h"
  30.  
  31. //
  32. // Need definition of comparison operand because we use them to compare
  33. //
  34. #include "ComparisonOperand.h"
  35.  
  36. #include <AEObjects.h>
  37. #include "AEPackObject.h"
  38.  
  39. #include "Exceptions.h"
  40.  
  41. //========================================================================================
  42. // CLASS TGenericSearchSpec
  43. //========================================================================================
  44.  
  45. #pragma segment ObjectResident
  46. ImplementSmallClassData(TGenericSearchSpec, clGenericSearchSpec);
  47.  
  48. #pragma segment SearchSpec
  49.  
  50.  
  51. //----------------------------------------------------------------------------------------
  52. // TGenericSearchSpec::~TGenericSearchSpec: 
  53. //----------------------------------------------------------------------------------------
  54. TGenericSearchSpec::~TGenericSearchSpec()
  55.     {
  56.     delete fOperand1;
  57.     delete fOperand2;
  58.     } // TGenericSearchSpec::~TGenericSearchSpec 
  59.  
  60. //----------------------------------------------------------------------------------------
  61. // TGenericSearchSpec::SpecificationOperator
  62. //----------------------------------------------------------------------------------------
  63. DescType TGenericSearchSpec::SpecificationOperator()
  64.     {
  65.     return fComparisonOperator;
  66.     }
  67.  
  68. //----------------------------------------------------------------------------------------
  69. // TGenericSearchSpec::Compare: 
  70. //----------------------------------------------------------------------------------------
  71. Boolean TGenericSearchSpec::Compare(const TAETransaction& t, TAbstractScriptableObject* itemToTest)
  72.     {
  73.     Boolean inSet = fOperand1->Compare(t, fComparisonOperator, *fOperand2, itemToTest);
  74.  
  75. #ifdef DIAGNOSTICS
  76.     ConditionalDebugPrintf(DEBUGCOPIOUS, "Result of TGenericSearchSpec::Compare is %d", inSet);
  77. #endif
  78.  
  79.     return inSet;
  80.     } // TGenericSearchSpec::Compare 
  81.  
  82. //----------------------------------------------------------------------------------------
  83. // TGenericSearchSpec::BuildWhoseTest: 
  84. //----------------------------------------------------------------------------------------
  85. TDescriptor TGenericSearchSpec::BuildWhoseTest()
  86.     {
  87.     TDescriptor compDescriptor;
  88.     TDescriptor operand1Desc;
  89.     TDescriptor operand2Desc;
  90.  
  91.     operand1Desc = fOperand1->SpecifierForOperand();
  92.     operand2Desc = fOperand2->SpecifierForOperand();
  93.     compDescriptor.MakeCompDescriptor(fComparisonOperator, operand1Desc, operand2Desc, true);
  94.         
  95.     return compDescriptor;
  96.     } // TGenericSearchSpec::BuildWhoseTest 
  97.  
  98.  
  99. //----------------------------------------------------------------------------------------
  100. // TGenericSearchSpec::GetRightHandComparisonOperand
  101. //----------------------------------------------------------------------------------------
  102. TComparisonOperand* TGenericSearchSpec::GetRightHandComparisonOperand()
  103.     {
  104.     return fOperand2;
  105.     }
  106.     
  107. //----------------------------------------------------------------------------------------
  108. // TGenericSearchSpec::GetLeftHandComparisonOperand
  109. //----------------------------------------------------------------------------------------
  110. TComparisonOperand* TGenericSearchSpec::GetLeftHandComparisonOperand()
  111.     {
  112.     return fOperand1;
  113.     }
  114.  
  115.